package by.gamedev.site.client.managed.activity;

import by.gamedev.site.client.app.place.ProxyListPlace;
import by.gamedev.site.client.managed.request.ApplicationEntityTypesProcessor;
import by.gamedev.site.client.managed.request.ApplicationRequestFactory;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceController;
import com.google.inject.Inject;

/**
 * Instantiates master activities.
 */
public final class ApplicationMasterActivities implements ActivityMapper {
//TODO    private final ApplicationRequestFactory requests;
  //TODO    private final PlaceController           placeController;

    @Inject
    public ApplicationMasterActivities(final ApplicationRequestFactory requests, final PlaceController placeController) {
      //TODO        this.requests = requests;
      //TODO        this.placeController = placeController;
    }

    @Override
    public Activity getActivity(final Place place) {
        if(!(place instanceof ProxyListPlace) ) {
            return null;
        }

        final ProxyListPlace listPlace = (ProxyListPlace) place;

        return new ApplicationEntityTypesProcessor<Activity>() {
            // TODO
            /*
             * @Override public void handleReport(ReportProxy isNull) { setResult(new ReportListActivity(requests, GameDevApp.isMobile() ?
             * ReportMobileListView.instance() : ReportListView.instance(), placeController)); }
             * 
             * @Override public void handleExpense(ExpenseProxy isNull) { setResult(new ExpenseListActivity(requests, GameDevApp.isMobile() ?
             * ExpenseMobileListView.instance() : ExpenseListView.instance(), placeController)); }
             * 
             * @Override public void handleEmployee(EmployeeProxy isNull) { setResult(new EmployeeListActivity(requests, GameDevApp.isMobile() ?
             * EmployeeMobileListView.instance() : EmployeeListView.instance(), placeController)); }
             */

        }.process(listPlace.getProxyClass());
    }
}
